<?php
function checkstock()
{
	foreach($_SESSION["ses_cart"] as $product)
	{
		$q=mysql_fetch_array(mysql_query("SELECT quantity FROM sme_product  WHERE productId='".$product["id"]."'"));
		if($q[0]<$product['quantity'])
		$_SESSION["ses_cart"][$product["id"]]["stock"]=$q[0];	
	}
}


?>